package com.v9.flow.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v9.flow.domain.model.SponsorTypeEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @author lunshi
 */
@Data
@Accessors(chain = true)
@TableName(value = "fl_sponsor", common = "发启者")
public class FlowSponsor {
    @TableField(common = "流程id")
    private Long flowId;
    @TableField(common = "发启者类型")
    private SponsorTypeEnum type;
    @TableField(common = "引用id")
    private String refId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof FlowSponsor that)) {
            return false;
        }
        return new EqualsBuilder().append(type, that.type).append(refId, that.refId).isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37).append(type).append(refId).toHashCode();
    }
}
